package com.pro.system.Repository;

import com.pro.system.entity.Movie;
import com.pro.system.entity.MovieDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface MovieDetailRepository extends JpaRepository<MovieDetail,Integer> {
    @Override
    List<MovieDetail> findAll();

    @Modifying
    @Transactional
    @Query(value = "select * from movie_detail where star like %?1% " ,nativeQuery = true)
    public List<MovieDetail> findByNameLike(String name);

    @Query(value = "select * from movie_detail where detail_id=?1 " ,nativeQuery = true)
    MovieDetail findByid(Integer id);
}
